// routes/dishRoutes.js
const express = require('express');
const router = express.Router();
const dishController = require('../controllers/dishController');
const authenticateToken = require('../middleware/auth');
const upload = require('../middleware/upload'); // 引入上传中间件
// 公共路由
router.get('/', dishController.getAllDishes);
router.get('/:id', dishController.getDishById);

// 管理员路由（需要认证）
router.post('/', authenticateToken,upload.single('image'), dishController.createDish);
router.put('/:id', authenticateToken, upload.single('image'), dishController.updateDish);
router.delete('/:id', authenticateToken, dishController.deleteDish);

module.exports = router;